<template>
  <div>
    <p>
      <el-icon class="icon1" @click="goBack"><Back /></el-icon>
      <span class="s1"><b>屏幕亮度</b></span>
    </p>

    <div class="d2">
      <div class="brightness-page">
        <div class="brightness-slider">
          <label for="brightness">
            <img
              src="../../assets/images//icon/common resource/hdpi/setting_icon_light_color_sun_n.png"
              alt=""
            />
          </label>
          <input
            style="width: 360px"
            type="range"
            id="brightness"
            min="0"
            max="100"
            v-model="brightness"
            @input="updateBrightness"
          />
          <span>
            <img
              src="../../assets/images/icon/common resource/hdpi/setting_icon_deep_color_sun_n.png"
              alt=""
            />
          </span>
        </div>

        <!-- 页面内容的容器，亮度调节作用于这个容器 -->
        <div class="content" :style="{ filter: 'brightness(' + brightness + '%)' }"></div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { Back } from '@element-plus/icons-vue'
import { ref } from 'vue'
const router = useRouter()

// 定义亮度变量，并设置初始值（这里初始值设为50，可根据实际需求调整）
const brightness = ref(50)

// 定义返回上一页的函数
const goBack = () => {
  router.back()
}
const login = () => {
  router.push({ path: '/login' })
}
const grxx = () => {
  router.push({ path: '/PersonalInformation' })
}

// 定义更新亮度的函数（这里简单示例，可根据实际需求完善逻辑）
const updateBrightness = () => {
  // 可以在这里添加具体的业务逻辑，比如发送请求告知后台亮度变化等，目前只是示例
}
</script>
<style scoped>
.brightness-page {
  text-align: center;
  margin-top: 50px;
}

.brightness-slider {
  margin-bottom: 20px;
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.brightness-slider input {
  width: 200px;
}

.content {
  margin-top: 20px;
  padding: 20px;
  background-color: lightgray;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  height: 100vh;
}

.icon1 {
  position: relative;
  left: 0.5rem;
  font-size: 20px;
  top: 0.2rem;
  color: #4d4b4b;
}
.s1 {
  position: relative;
  font-size: 13px;
  left: 4rem;
  color: #4d4b4b;
}
.login1-img {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  position: relative;
  left: 0.5rem;
}
.s2 {
  position: relative;
  font-size: 0.6rem;
  top: -0.5rem;
  left: 1rem;
}
.icon2 {
  position: relative;
  left: 5.8rem;
  font-size: 0.4rem;
  top: -0.5rem;
  color: #ccc;
}
.p1 {
  border-bottom: 3px solid #ccc;
  justify-content: center;
  margin-top: 10px;
}
.btn1 {
  width: 100%;
  height: 45px;
  background-color: white;
  border: none;
  font-size: 16px;
  color: red;
  font-size: 30px;
  text-align: center;
}
.d2 {
  margin-top: 0.5rem;
}
</style>
